<script setup>

import {baseUrl} from "../../api/http";
import {go} from "../../tools/go";


const props = defineProps({
  img: {
    type: String,
    default: ''
  },
  text: {
    type: String,
    default: ''
  },
  size: {
    type: Number,
    default: 0
  },
  href: {
    type: String,
    default: ''
  }
})

const menuGo = () => {
  console.log(props.href)
  const href = props.href
  if (href === ''|| href === '#' || href === null || href === undefined || href === 'none') {
    return
  }
  return go(href)
}

</script>

<template>
<view class="menu_item" @click="menuGo">
  <img class="img" :style="size === 0 ? '': `width: ${size}px;height: ${size}px`" :src="baseUrl + img" />
  <text>{{text}}</text>
</view>
</template>

<style scoped lang="scss">
.menu_item{
  img{
    width: 50px;
    height: 50px;
  }
  display: flex;
  flex-direction: column;
  align-items: center;
}
</style>